package com.sunducation.wts.databinding

import android.graphics.drawable.Drawable
import android.widget.ImageView
import androidx.databinding.BindingAdapter
import com.bumptech.glide.Glide

//必须在最外层，否则报错, 不仅可以设置图片，也可以设置控件是否显示，显示文字等等，自定义标签
@BindingAdapter(value=["bind:image"])
fun imageLoader(imageView: ImageView, url: String){
    Glide.with(imageView.context).load(url).into(imageView)
}


@BindingAdapter(value = ["imageUrl", "error"], requireAll = false)
fun imageLoader2(imageView: ImageView, url: String, error: Drawable){
    Glide.with(imageView.context).load(url).into(imageView)
}



